package com.yhsimon.reflection;

public class Test05 {
    public static void main(String[] args) throws ClassNotFoundException {

        //获取系统类加载器
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        System.out.println(systemClassLoader);

        //获取扩展类加载器
        ClassLoader parent = systemClassLoader.getParent();
        System.out.println(parent);

        //获取引导类加载器(C/C++) 返回null
        ClassLoader parent1 = parent.getParent();
        System.out.println(parent1);

        //测试当前类是哪个类加载器加载的
        ClassLoader classLoader = Class.forName("com.yhsimon.reflection.Test05").getClassLoader();
        System.out.println(classLoader);

        //测试JDK内置类是哪个类加载器加载的
        classLoader=Class.forName("java.lang.Object").getClassLoader();
        System.out.println(classLoader);

        //查看系统类加载器可以加载的路径
        System.out.println(System.getProperty("java.class.path"));

    }
}
